<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>##yourLibrary##</title>
<meta name="description" content="a library for the programming environment processing" />
<meta name="keywords" content="processing.org, library" />
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Language" content="en-us" />
<meta name="ROBOTS" content="index,follow,archive" />
<meta http-equiv="imagetoolbar" content="false" />
<meta name="MSSmartTagsPreventParsing" content="true" />
<meta name="author" content="##author##" />
<meta name="Rating" content="General" />
<meta name="revisit-after" content="7 Days" />
<meta name="doc-class" content="Living Document" />
<link rel="stylesheet" type="text/css" href="./stylesheet.css">
</head>
<body>
    <div id="container">

        <div id="header">
            <h1>##yourLibrary## v##versionNumber##</h1>
        </div>

        <div id="menu" class="clear">
            <ul>
                <li><a href="#about">About</a> \ </li>
                <li><a href="##yourLibrary##_##versionNumber##.zip">Download</a> \ </li>
                <li><a href="#download">Installation</a> \ </li>
                <!-- <li><a href="#examples">Examples</a> \ </li>-->
                <li><a href="#demos">Demo</a> \ </li>				
                <li><a href="./reference/index.html" target="_blank">Reference</a></li>
                <!-- <li><a href="#misc">Misc</a> \ </li> -->
                <!-- <li><a href="#images">Images</a> \ </li> -->
            </ul>
        </div>

        <div id="content" class="clear">

            <div id="demos" class="clear">
                <table><tr>
            <td>
<pre>import peasy.*;

PeasyCam cam;

void setup() {
  size(200,200,P3D);
  cam = new PeasyCam(this, 100);
  cam.setMinimumDistance(50);
  cam.setMaximumDistance(500);
}
void draw() {
  rotateX(-.5);
  rotateY(-.5);
  background(0);
  fill(255,0,0);
  box(30);
  pushMatrix();
  translate(0,0,20);
  fill(0,0,255);
  box(5);
  popMatrix();
}
</pre>
            </td>
            </tr></table>
            </div>


            <div id="about">
            <h2>##yourLibrary## v##versionNumber##</h2>
            <p>
            A library by <a href="##yourLink##">##author##</a> for the
            programming environment
            <a href="http://www.processing.org" target="_blank">processing</a>.
            Distributed under the <a href="http://www.apache.org/licenses/LICENSE-2.0.html">Apache Public License, version
            2.0</a>.
            Last update, ##date##.
            </p>

<p>PeasyCam provides a dead-simple mouse-driven camera for Processing. </p>
<h3>Example</h3>
<pre>PeasyCam camera;

void setup() {
  camera = new PeasyCam(this, 0, 0, 0, 50);
}</pre>
<p>
    That's it. Now a mouse left-drag will rotate the camera around the subject, 
    a right drag will zoom in and out, and a middle-drag (command-left-drag on mac) will pan. A 
    double-click restores the camera to its original position. The shift key constrains rotation
    and panning to one axis or the other.
</p>
<p>
    The PeasyCam is positioned on a sphere whose radius is the given 
    distance from the look-at point. Rotations are around axes that 
    pass through the looked-at point.
</p>

<p>
    PeasyCam is impervious to gimbal lock, and has no known "singularities" or 
    discontinuities in its behavior. It relies on the excellent 
    <a href="http://commons.apache.org/math/">Apache Commons Math</a>
    <a href="http://commons.apache.org/math/userguide/geometry.html">geometry package</a>
    for its rotations.
</p>

<h2>Thanks</h2>
<p>Useful bug reports and feature suggestions were provided by:</p>
<ul>
<li><a href="http://ooish.com/">Oori Shalev</a></li>
<li>Jeffrey Gentes</li>
<li><a href="http://imaginationfeed.com">A.W. Martin</a></li>
<li><a href="http://prototy.blogspot.com/">Yiannis Chatzikonstantinou</a></li>
<li><a href="http://milkbox.net/">Donald Ephraim Curtis</a></li>
<li><a href="http://www.michael-kaufmann.ch/">Michael Kaufmann</a></li>
<li><a href="http://wiki.uelceca.net/msc0809/published/gennaro+senatore">Gennaro Senatore</a></li>
</ul>
<p>Please let me know if I've forgotten to acknowledge you.</p>

    <div id="download">
	    <h2>Installing Peasycam</h2>
		<h3>Processing 1.5.1</h3> 
		<p>You can download a version of Peasycam compatible with Processing 1.5.1 here:
		<a href="http://static.mrfeinberg.com/peasycam/peasycam_15100.zip"
		   >http://static.mrfeinberg.com/peasycam/peasycam_15100.zip</a>
		</p>
		
		<h3>Processing 2 and Later</h3>
		<p>You can install the latest Peasycam from within Processing via the
		menus <b>Sketch&nbsp;&gt;&nbsp;Import Library...&nbsp;&gt;&nbsp;Add Library...</b>
		</p>            
    </div>	


<h3>Constructors</h3>
<pre class="prettyprint">PeasyCam(PApplet parent, double lookAtX, double lookAtY, double lookAtZ, double distance);
PeasyCam(PApplet parent, double distance); // look at 0,0,0
</pre>

<h3>Methods</h3>
<pre class="prettyprint">camera.setActive(boolean active);  // false to make this camera stop responding to mouse

// By default, the camera is in "free rotation" mode, but you can
// constrain it to any axis, around the look-at point:
camera.setYawRotationMode();   // like spinning a globe
camera.setPitchRotationMode(); // like a somersault
camera.setRollRotationMode();  // like a radio knob
camera.setSuppressRollRotationMode();  // Permit pitch/yaw only.

// Then you can set it back to its default mode:
camera.setFreeRotationMode();

// reassign particular drag gestures, or set them to null
camera.setLeftDragHandler(PeasyDragHandler handler);
camera.setCenterDragHandler(PeasyDragHandler handler);
camera.setRightDragHandler(PeasyDragHandler handler);
PeasyDragHandler getPanDragHandler();
PeasyDragHandler getRotateDragHandler();
PeasyDragHandler getZoomDragHandler();

// mouse wheel zooms by default; set null, or make your own
camera.setWheelHandler(PeasyWheelHandler handler);
PeasyWheelHandler getZoomWheelHandler();

// change sensitivity of built-in mouse wheel zoom
camera.setWheelScale(double scale); // 1.0 by default
double getWheelScale();

// make your own!
public interface PeasyDragHandler {
    public void handleDrag(final double dx, final double dy);
}
public interface PeasyWheelHandler {
    public void handleWheel(final int delta);
}
camera.setResetOnDoubleClick(boolean resetOnDoubleClick); // default true

camera.lookAt(double x, double y, double z);
camera.lookAt(double x, double y, double z, long animationTimeInMillis);
camera.lookAt(double x, double y, double z, double distance);
camera.lookAt(double x, double y, double z, double distance, long animationTimeInMillis);

camera.rotateX(double angle);  // rotate around the x-axis passing through the subject
camera.rotateY(double angle);  // rotate around the y-axis passing through the subject
camera.rotateZ(double angle);  // rotate around the z-axis passing through the subject
camera.setDistance(double d);  // distance from looked-at point
camera.pan(double dx, double dy);   // move the looked-at point relative to current orientation

double camera.getDistance();  // current distance
float[] camera.getLookAt();  // float[] { x, y, z }, looked-at point

camera.setMinimumDistance(double minimumDistance);
camera.setMaximumDistance(double maximumDistance);  // clamp zooming

camera.reset();
camera.reset(long animationTimeInMillis);  // reset camera to its starting settings

CameraState state = camera.getState(); // get a serializable settings object for current state
camera.setState(CameraState state);
camera.setState(CameraState state, long animationTimeInMillis); // set the camera to the given saved state

float[] rotations = camera.getRotations(); // x, y, and z rotations required to face camera in model space
camera.setRotations(double pitch, double yaw, double roll); // rotations are applied in that order
float[] position = camera.getPosition(); // x, y, and z coordinates of camera in model space

// Utility methods to permit the use of a Heads-Up Display
// Thanks, A.W. Martin
camera.beginHUD();
// now draw things that you want relative to the camera's position and orientation
camera.endHUD(); // always!</pre>
</div>

<div id="resources">
  <p><strong>Keywords</strong> ##keywords##</p>
  <p><strong>Reference</strong>. Have a look at the javadoc reference <a href="./reference/index.html" target="_blank">here</a>. a copy of the reference is included in the .zip as well.</p>		
  <p><strong>Source</strong>. The source code of ##yourLibrary## 
  is available at <a href="##source:url##">##source:host##</a>, 
  and its repository can be browsed 
  <a href="##source:repository##" target="_blank">here</a>. Fork it and fix it!</p>			
</div>

<!-- 
<div id="examples" class="clear">
  <h2>Examples</h2>
  <p>Find a list of examples in the current distribution of ##yourLibrary##, or have a look at them by following the links below.</p>
  <ul>
    ##examples##
  </ul>
</div>
-->

<div id="info">
  <h2>Tested</h2>
  <p>
  <!-- on which platform has the library been tested? -->
  <strong>Platform</strong> ##tested:platform##

  <!-- which processing version did you use for testing your library? -->
  <br /><strong>Processing</strong> ##tested:processingVersion##

  <!-- does your library depend on any other library or framework? -->
  <br /><strong>Dependencies</strong> ##tested:dependencies##
  </p>
</div>



<!-- use the misc section for other relevant information. Activate the link to the misc section in the menu above. -->
<!--
<div id="misc" class="clear">
  <p></p>
</div>
-->

<!-- use the images/screenshots section. Activate the link to the misc section in the menu above. -->
<!--
<div id="images" class="clear">
</div>
-->


<br class="clear" />
        </div>

        <div id="footer">
          <p>by ##author##, 2013.</p>
        </div>
      </div>
    </body>
  </html>
